package com.jxpanda.spring.module.wechat.component.message.pojo.template;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.jxpanda.spring.module.wechat.component.message.pojo.WechatMessage;
import com.jxpanda.spring.module.wechat.component.message.pojo.template.section.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * 按钮交互型模板卡片消息，提供了多个交互按钮。
 *
 * @author Panda
 */
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@Data
public class WechatButtonInteractionCardMessage extends WechatMessage {

    /**
     * 模板卡片详细内容，特定于按钮交互型消息。
     */
    @JsonProperty("template_card")
    private TemplateCard templateCard;


    public static TemplateBuilder templateBuilder() {
        return new TemplateBuilder();
    }

    public static class TemplateBuilder {
        private Source source;
        private ActionMenu actionMenu;
        private MainTitle mainTitle;
        private QuoteArea quoteArea;
        private String subTitleText;
        private List<HorizontalContent> horizontalContentList;
        private CardAction cardAction;
        private String taskId;
        private ButtonSelection buttonSelection;
        private List<Button> buttonList;

        public TemplateBuilder source(Source source) {
            this.source = source;
            return this;
        }

        public TemplateBuilder actionMenu(ActionMenu actionMenu) {
            this.actionMenu = actionMenu;
            return this;
        }

        public TemplateBuilder mainTitle(MainTitle mainTitle) {
            this.mainTitle = mainTitle;
            return this;
        }

        public TemplateBuilder quoteArea(QuoteArea quoteArea) {
            this.quoteArea = quoteArea;
            return this;
        }

        public TemplateBuilder subTitleText(String subTitleText) {
            this.subTitleText = subTitleText;
            return this;
        }

        public TemplateBuilder horizontalContentList(List<HorizontalContent> horizontalContentList) {
            this.horizontalContentList = horizontalContentList;
            return this;
        }

        public TemplateBuilder cardAction(CardAction cardAction) {
            this.cardAction = cardAction;
            return this;
        }

        public TemplateBuilder taskId(String taskId) {
            this.taskId = taskId;
            return this;
        }

        public TemplateBuilder buttonSelection(ButtonSelection buttonSelection) {
            this.buttonSelection = buttonSelection;
            return this;
        }

        public TemplateBuilder buttonList(List<Button> buttonList) {
            this.buttonList = buttonList;
            return this;
        }

        public TemplateCard build() {
            TemplateCard templateCard = new TemplateCard();
            templateCard.setCardType("button_interaction");
            templateCard.setSource(source);
            templateCard.setActionMenu(actionMenu);
            templateCard.setMainTitle(mainTitle);
            templateCard.setQuoteArea(quoteArea);
            templateCard.setSubTitleText(subTitleText);
            templateCard.setHorizontalContentList(horizontalContentList);
            templateCard.setCardAction(cardAction);
            templateCard.setTaskId(taskId);
            templateCard.setButtonSelection(buttonSelection);
            templateCard.setButtonList(buttonList);
            return templateCard;
        }

    }

}

